/**
 * @author zhaozeyang
 * @date 2018/11/7 20:33
 * @description
 */
public class 八十三 {

    public static void main(String[] args) {
       ListNode head=ListNode.create(1,1,2,3,3);
       System.out.println(head);
       System.out.println(deleteDuplicates(head));
    }

    public static ListNode deleteDuplicates(ListNode head) {
        if (head == null) {
            return null;
        }
        ListNode cur = head.next;
        ListNode pre = head;
        while (cur != null) {
            if (cur.val == pre.val) {
                pre.next = cur.next;
                cur=cur.next;
            } else {
                pre = cur;
                cur = cur.next;
            }
        }
        return head;
    }
}

